package com.caocaog.market.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 商品历史记录
 *
 * @author jeecg-boot
 * @date 2021-11-20
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("mk_goods_his")
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "mk_goods_his对象", description = "商品历史")
public class GoodsHis implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;

    @ApiModelProperty(value = "版本")
    private Integer lockVersion;

    @ApiModelProperty(value = "商品id")
    private String goodsId;

    @ApiModelProperty(value = "商品全称")
    private String name;

    @ApiModelProperty(value = "商品简称")
    private String shortName;

    @ApiModelProperty(value = "商品分类")
    private String sorts;

    @ApiModelProperty(value = "商品原价")
    private String originalPrice;

    @ApiModelProperty(value = "商品现价")
    private String presentPrice;

    @ApiModelProperty(value = "商品代码")
    private String code;

    @ApiModelProperty(value = "商品图片")
    private String picture;

    @ApiModelProperty(value = "商品完整描述")
    private String description;

    /*@ApiModelProperty(value = "商品简单描述")
    private String shortDescription;*/

    @ApiModelProperty(value = "商品上下架状态")
    private String status;

    @ApiModelProperty(value = "是否首页展示")
    private String isIndex;

    @ApiModelProperty(value = "是否热门商品")
    private String isHot;

    @ApiModelProperty(value = "是否单点不送")
    private String oneNoDelivery;

    @ApiModelProperty(value = "浏览次数")
    private Integer visitNum;

    @ApiModelProperty(value = "销售数量")
    private Integer saleNum;

    @ApiModelProperty(value = "是否删除")
    private Integer delFlag;

    @ApiModelProperty(value = "所属门店")
    private String shopId;

    @TableField("goods_attribute")
    @ApiModelProperty(value = "商品属性")
    private String goodsAttr;

    @TableField("goods_specifications")
    @ApiModelProperty(value = "商品规格")
    private String goodsSpec;

    @ApiModelProperty(value = "起售数量")
    private Integer salesQuantity;

    @ApiModelProperty(value = "是否是单个规格")
    private Boolean singleSpec;

    public GoodsHis(GoodsBase goodsBase) {
        this.goodsId = goodsBase.getId();
        this.code = goodsBase.getCode();
        this.createBy = goodsBase.getUpdateBy();
        this.delFlag = goodsBase.getDelFlag();
        this.lockVersion = goodsBase.getLockVersion();
        this.name = goodsBase.getName();
        this.shopId = goodsBase.getShopId();
        this.sorts = goodsBase.getSorts();
        this.description = goodsBase.getDescription();
        this.status = goodsBase.getStatus();
        this.isHot = goodsBase.getIsHot();
        this.oneNoDelivery = goodsBase.getOneNoDelivery();
        this.isIndex = goodsBase.getIsIndex();
        this.picture = goodsBase.getPicture();
        this.originalPrice = goodsBase.getOriginalPrice();
        this.presentPrice = goodsBase.getPresentPrice();
        this.saleNum = goodsBase.getSaleNum();
        this.shortName = goodsBase.getShortName();
        this.code = goodsBase.getCode();
        this.visitNum = goodsBase.getVisitNum();
        this.singleSpec = goodsBase.getSingleSpec();
        this.salesQuantity = goodsBase.getSalesQuantity();
    }


}
